package com.mew.chess.core.common.message.request;

import com.zebra.common.ZebraBaseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;


@Data
@ToString
@NoArgsConstructor
public class ReconnectionGameRequestMessage extends ZebraBaseMessage<ReconnectionGameRequestMessage> {
    private String encryptionStr; //加密字符串 大厅编号@TOKEN@StartTime
    private long startTime;

    private int roomId;

    @Override
    public void write(ByteBuf b) {
        writeString(b, this.encryptionStr);
        writeLong(b, this.startTime);
        writeInt(b, this.roomId);
    }

    @Override
    public ReconnectionGameRequestMessage read(ByteBuf b) {
        ReconnectionGameRequestMessage requestMessage = new ReconnectionGameRequestMessage();
        requestMessage.encryptionStr = readString(b);
        requestMessage.startTime = readLong(b);

        requestMessage.roomId = readInt(b);
        return requestMessage;
    }

}
